{/include file=$this->header_file /}
<!-- 以上顶部信息不要改-->
<link rel="stylesheet" type="text/css" href="/css/acl.css" />
<div id="acl">
{/include file=$this->location_file /}

{/if $do_type == 'no'/}
<table width="80%" border="1" align="center">
  <tr>
    <th width="50%"><form id="form1" name="form1" method="post" action="">按照<input type="text" name="search_string" />
        <select name="select">
          <option value="0">用户名</option>
          <option value="1">中文名</option>
        </select>
      <input type="submit" name="Submit" value="搜索" style="background:#FF0000;"/>
    </form></th>
    <th width="50%" ><a href="{/$www_root_url/}/acladmin/user/?do_type=add">新增用户</a></th>
  </tr>
</table>
<form id="form2" name="form2" method="post" action="">
<table width="80%" border="1" align="center">
   <tr>
    <th>&nbsp;</th>
    <th>用户名</th>
    <th>用户组</th>
    <th>部门</th>
    <th>中文名</th>
    <th>英文名</th>
	<th>email</th>
    <th>最后登陆时间</th>
    <th>查看详细</th>
    <th>修改</th>
  </tr>
  
  <script language="javascript">
function all_check(){
    var i;
    for (i=1;i<=document.getElementById("count").value;i++){
	    if (document.getElementById("all"+i).checked == true){
		    document.getElementById("all"+i).checked = false;
		}else{
		    document.getElementById("all"+i).checked = true;
		}
	}
}
</script>
  {/section name=sec1 loop=$result_user/}
  <tr onmouseover="this.style.background='#FFFF66'" onmouseout="this.style.background=''">
    <td><input type="checkbox" name="id[]" value="checkbox" id="all{/$smarty.section.sec1.rownum/}" value="{/$result_user[sec1].userid/}" /></td>
    <td>{/$result_user[sec1].username/}</td>
    <td>{/$result_user[sec1].user_group/}</td>
    <td>{/$result_user[sec1].dp_id/}</td>
    <td>{/$result_user[sec1].realname/}</td>
    <td>{/$result_user[sec1].realname_e/}</td>
    <td>{/$result_user[sec1].email/}</td>
	<td title="{/$result_user[sec1].last_ip/}">{/$result_user[sec1].last_login_date/}</td>
    <td>点击查看</td>
    <td>修改</td>
  </tr>
  {//section/}
 
</table>
<div align="center">
<input type="checkbox" name="checkbox" onclick="all_check();" value="checkbox" />全选/全不选
<input type="submit" name="Submit4" value="提交" />
<input type="hidden" id="count" value="{/$result_user|@count/}" />
{/$page_list/}</div>
</form>
{//if/}
{/if $do_type == 'add'/}
<Script   language="JavaScript">   
     //验证表单
      function   check_add()   
      {       
       if   (form3.username.value == "")   
          {   
              alert("请输入用户名!");   
              form3.username.focus();   
              return   (false);   
          } 
		  
	   if   ( form3.password.value == "")   
          {   
              alert("请输入密码!");   
              form3.password.focus();   
              return   (false);   
          }
	   if   ( form3.repassword.value == "" && form3.password.value != form3.re_password.value)   
          {   
              alert("请确认密码!");   
              form3.repassword.focus();   
              return   (false);   
          } 
		 if   ( form3.email.value == "")   
          {   
              alert("请输入邮箱!");   
              form3.email.focus();   
              return   (false);   
          }
		 if   ( form3.realname.value == "")   
          {   
              alert("请输入中文名!");   
              form3.realname.focus();   
              return   (false);   
          }
		  if   ( form3.realname_e.value == "")   
          {   
              alert("请输入英文名!");   
              form3.realname_e.focus();   
              return   (false);   
          }
		  if   ( form3.phone.value == "")   
          {   
              alert("请输入电话!");   
              form3.phone.focus();   
              return   (false);   
          }
      }  
	  /**
	  * 检测不为空,参数:要检测的id,输出的div名字,输出内容
	  */
	  function check(check_id,div,info){
	      if (document.getElementById(check_id).value == '') 
		  	document.getElementById(div).innerHTML='<font color=red>'+info+'</font>'; 
		  else 
		    document.getElementById(div).innerHTML='填写正确';
	  }
	  
	  /**
	  * 检测是否相同,参数:要检测的id1,要检测的id2,输出的div名字,输出内容
	  */
	  function check_same(check_id1,check_id2,div_out,info_out){
	      if (document.getElementById(check_id1).value == '' || document.getElementById(check_id2).value == '') {
		      document.getElementById(div_out).innerHTML='<font color=red>请填写!</font>';
			  return false;
		  }
	      if (document.getElementById(check_id1).value != document.getElementById(check_id2).value ) 
		  	document.getElementById(div_out).innerHTML='<font color=red>'+info_out+'</font>'; 
		  else 
		    document.getElementById(div_out).innerHTML='填写正确';
	  }
</Script>
<form id="form3" name="form3" method="post" action="{/$www_root_url/}/acladmin/user/?do_type=add" onsubmit="return check_add();">
<table width="50%" border="1" align="center">
  <tr>
    <th colspan="2">添加新用户&nbsp;&nbsp;&nbsp;<a href='javascript:location.reload();'>刷新页面</a>&nbsp;&nbsp;&nbsp;<a href='javascript:history.go(-1)'>返回</a> </th>
  </tr>
  <tr>
    <td width="30%">用户名</td>
    <td><input type="text" name="username" id="username" onblur="check('username','username_out','请输入用户名')"/><div id='username_out'></div></td>
  </tr>
  <tr>
    <td width="30%">密码</td>
    <td><input type="password" name="passwd" id="password" onblur="check('passwd','password_out','请输入密码')"/><div id='password_out'></div></td>
  </tr>
  <tr>
    <td width="30%">密码确认</td>
    <td><input type="password" name="repassword" id="repassword"  onblur="check('repassword','repassword_out','请输入确认密码');check_same('repassword','password','repassword_out','密码和确认密码必须一致')"/><div id='repassword_out'></div></td>
  </tr>
  <tr>
    <td width="30%">用户组</td>
    <td>
      <select name="user_group">
	     {/foreach name=sjf_list_1 key=key1 item=item1 from=$group_name_en/}
		     <option value="{/$item1/}">{/$group_name_zh[$key1]/}</option>
		 {//foreach/}	     
      </select>
      </td>
  </tr>
  <tr>
    <td width="30%">邮箱</td>
    <td><input type="text" name="email" id="email" onblur="check('email','email_out','请输入邮箱')" /><div id='email_out'></div></td>
  </tr>
  <tr>
    <td width="30%">部门</td>
    <td>
      <select name="dp_id">
        {/foreach name=sjf_list_2 key=key2 item=item2 from=$dp_id/}
		     <option value="{/$item2/}">{/$dp_id_name[$key2]/}</option>
		 {//foreach/}	
      </select></td>
  </tr>
  
  <tr>
    <td width="30%">中文名</td>
    <td><input type="text" name="realname" id="realname" onblur="check('realname','realname_out','请输入中文名')" /><div id='realname_out'></div></td>
  </tr>
  <tr>
    <td width="30%">英文名</td>
    <td><input type="text" name="realname_e" id="realname_e" onblur="check('realname_e','realname_e_out','请输入英文名')" /><div id='realname_e_out'></div></td>
  </tr>
  <tr>
    <td width="30%">分机</td>
    <td><input type="text" name="phone" id="phone" onblur="check('phone','phone_out','请输入电话号码或分机号码')" /><div id='phone_out'></div></td>
  </tr>
  <tr>
    <td width="30%">自我介绍</td>
    <td><input type="text" name="intro" /></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input type="submit" name="Submit2" value="提交" style="background:#FF0000;" />
      <input type="reset" name="Submit3" value="重置" style="background:#0000FF;" /></td>
    </tr>
</table>
</form>
{//if/}

</div>
<!-- 以下底部信息不要改-->
{/include file=$this->bottom_file /}